package com.wanjia.bpsapi.properties;

import com.wanjia.bpsapi.constant.CronTaskType;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.io.Serializable;
import java.util.List;

@Data
@Configuration
@ConfigurationProperties("corn-task-config")
public class CronTaskProperties implements Serializable {

    private Boolean enable = true;

    private List<CronTask> tasks;

    @Data
    public static class CronTask implements Serializable {

        private Boolean enable = true;

        private String cron;

        private CronTaskType type = CronTaskType.BEAN;

        private Class<?> target;

        private String method;

        private Class<? extends Runnable> runnable;
    }
}
